import React, { useMemo } from 'react'
import './index.scss'

const TitleBlock = ({ withStar = true, title = '' }) =>
  useMemo(() => {
    const Star = (
      <img
        src={'http://fepublicty.tiyalive.com/tiya/activities/us-halloween/title-star-icon@2x.png'}
        alt="title-star-icon"
        className="title-block__decorate"
      />
    )

    return (
      <div className="title-block">
        {withStar && Star}
        <span>{title}</span>
        {withStar && Star}
      </div>
    )
  }, [withStar, title])

export default TitleBlock
